<?php
namespace app\index\controller;
use think\Db;
use think\Controller;
use think\facade\Request;
class Base extends Controller
{
    public function __construct()
    {
        parent::__construct();
//      session('card_id','81000001');
        $card_id = session('card_id');
        if (!$card_id) {
            //跳转猫酷登陆
            $back_url = Request()->domain().'/index/Login/index';
            $mk_url = (new MallcooApi())->getOauthUrl($back_url);
            $this->redirect($mk_url);
        }
//      $MallcooApi = new MallcooApi();
//      $ticket  = input('Ticket');
//      if (empty($ticket)) {
//          $sCallbackUrl = $MallcooApi->getOauthUrl(Request::url(true));
//          return $this->redirect($sCallbackUrl);
//      }else{
//      	$userinfo = $MallcooApi->GetTokenByTicket($ticket);
//      	if($userinfo['Code']==30007){
//      		$sCallbackUrl = $MallcooApi->getOauthUrl(Request::url(true));
//	            return $this->redirect($sCallbackUrl);
//      	}else{
//      		session('userinfo', $userinfo);
//      	}
//      }
    }
}